Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #56

Merged
merged 14 commits into from
Jul 20, 2024
Merged

Cleanup #56

merged 14 commits into from
Jul 20, 2024

Conversation

Lyfts
Copy link
Member

@Lyfts Lyfts commented Jun 26, 2024

I felt compelled to do this after noticing this casting hell

if (TileVisRelay.nearbyPlayers.containsKey(Integer.valueOf(entity.getEntityId())))
if ((((WeakReference) TileVisRelay.nearbyPlayers.get(Integer.valueOf(entity.getEntityId()))).get()
!= null)
&& (((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId()))).get())
.getDistanceFrom(entity.posX, entity.posY, entity.posZ)
< 26.0D)) {
Aspect aspect = getAspect(stack);
int amt = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId()))).get()).consumeVis(aspect, 1);
if (amt > 0) {
this.setDamage(stack, getDamage(stack) - amt);
((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId()))).get())
.triggerConsumeEffect(aspect);
if (world.isRemote) {
ForgeDirection d2 = ForgeDirection.getOrientation(
((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId())))
.get()).orientation);
double x = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId()))).get()).xCoord + .5
+ d2.offsetX * .05;
double y = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId()))).get()).yCoord + .5
+ d2.offsetY * .05;
double z = ((TileVisRelay) ((WeakReference) TileVisRelay.nearbyPlayers
.get(Integer.valueOf(entity.getEntityId()))).get()).zCoord + .5
+ d2.offsetZ * .05;
double[] playerPos = ClientUtilities
.getPlayerHandPos((EntityPlayer) entity, true);
powerBeams.put(
entity.getEntityId(),
Thaumcraft.proxy.beamPower(
world,
x,
y,
z,
playerPos[0],
playerPos[1],
playerPos[2],
((aspect.getColor() >> 16) & 0xff) / 255f,
((aspect.getColor() >> 8) & 0xff) / 255f,
(aspect.getColor() & 0xff) / 255f,
false,
powerBeams.get(entity.getEntityId())));
}
}

It's mostly surface level stuff so nothing should break. (i hope)

@Lyfts Lyfts requested a review from a team June 26, 2024 19:36
Copy link
Contributor

@Ethryan Ethryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise I can’t see anything in need of a change.

@Lyfts Lyfts requested review from Ethryan and a team July 20, 2024 16:40
Copy link
Contributor

@Ethryan Ethryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@Dream-Master Dream-Master merged commit 351df36 into master Jul 20, 2024
1 check passed
@Dream-Master Dream-Master deleted the cleanup branch July 20, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants